<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="widtfh=device-width, initial-scale=1.0">
    <title>Document</title>
  <style>
    .green{
        color: green;
    }
  </style>
</head>
<body>
    <div id="app">
        <ul>
            <li :class={green:test(index)} @click="change(index)" v-for="(item,index) in list">{{item}}</li>
        </ul>
      </div>
      <script src="../node_modules/vue/dist/vue.js"></script>
      <script>
        new Vue({
          el: "#app",
          data: {
            msg: "hello,world",
            list:[
                '海王','火影','神奇宝贝','黑猫警长'
            ],
            color:'green',
            flag:false,
            sign:-1
          },
          methods:{
            change(inedx){
             this.sign=inedx;
            },
            test(index){
              return index===this.sign
            }
          }
        })
      </script>    
</body>
</html>